{% extends "howto" %}

{% block main %}
<h2 id="loading-a-kit">Loading a library Kit</h2>
<p>Webappkit archive should be unzipped at the root of your website.
Before including a Kit, insert once this line into your script :</p>

<code>// loading Webappkit core files
include('webappkit/include-me.php');</code>

<p>When you need a library kit, like <q>example</q>,
<strong>load it</strong> with :</p>

<code>// loading example kit library files
webappkit::loadKit('example');</code>

<p>Webappkit allows Kits nesting and use a dot syntax to access nested kits.
If you need only a <em>subkit</em>, let's say <em>hello</em> within <em>example</em>, load it with :</p>

<code>// loading hello subkit from example kit files
webappkit::loadKit('example.hello');</code>

<p>In this example, <q>example.hello</q> require <q>example.base</q>.
But you don't have to worry about that, thanks to internal dependancies handling.</p>

<h3>How it works</h3>

<p>When you load a kit, Webappkit searches into the kits root folder (usually <q>webappkit/</q>) a folder with this name plus <q>.wak</q>,
And reads its meta-data file <q>wak.ini</q>. This file describes kits dependancies which will be loaded, then own kit's files to load.</p>

<p>If you target a subkit, Webappkit will crawl through physical kits tree to find the targeted kit. So <q>example.hello.world</q> references the kit folder <q>example.wak/hello.wak/world.wak/</q>.</p>
{% endblock %}
